From 2569814496e2c7e61a06d9ddc48defd28759dd96 Mon Sep 17 00:00:00 2001 From: Stefano Stabellini Date: Tue, 13 Sep 2011 10:32:24 +0100 Subject: [PATCH] xen: if mapping GSIs we run out of pirq < nr_irqs_gsi, use the others PV on HVM guests can have more GSIs than the host, in that case we could run out of pirq < nr_irqs_gsi. When that happens use pirq >= nr_irqs_gsi rather than returning an error. Signed-off-by: Stefano Stabellini Tested-by: Benjamin Schweikert --- xen/arch/x86/irq.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c index 71fea2d74f..9ea29bac76 100644 --- a/xen/arch/x86/irq.c +++ b/xen/arch/x86/irq.c @@ -1646,15 +1646,12 @@ int get_free_pirq(struct domain *d, int type, int index) return i; } } - else - { - for ( i = d->nr_pirqs - 1; i >= nr_irqs_gsi; i-- ) - if ( is_free_pirq(d, pirq_info(d, i)) ) - { - pirq_get_info(d, i); - return i; - } - } + for ( i = d->nr_pirqs - 1; i >= nr_irqs_gsi; i-- ) + if ( is_free_pirq(d, pirq_info(d, i)) ) + { + pirq_get_info(d, i); + return i; + } return -ENOSPC; } -- 2.30.2